TryTake Method (T)

Task Parallel System.Threading

Attempts to remove an item from the BlockingCollection<(Of <(T>)>).

Namespace:  System.Collections.Concurrent
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Function TryTake ( _
	<OutAttribute> ByRef item As T _
) As Boolean
C#
public bool TryTake(
	out T item
)

Parameters

item
Type: T %
The item removed from the collection.

Return Value

true if an item could be removed; otherwise, false.

Exceptions

ExceptionCondition
System..::.ObjectDisposedExceptionThe BlockingCollection<(Of <(T>)>) has been disposed.
System..::.InvalidOperationExceptionThe underlying collection was modified outside of this BlockingCollection<(Of <(T>)>) instance.

See Also